{
PROB : skate
LANG : PASCAL
ID : phamnamlo2
}

program skate;
const
  fi = 'skate.in';
  fo = 'skate.out';
  dx : array[1..4] of integer = (0, 1, -1, 0);
  dy : array[1..4] of integer = (1, 0, 0, -1);
var
  a : array[1..113, 1..77] of char;
  trace : array[1..113, 1..77] of integer;
  found : boolean;
  m, n : integer;

procedure inp;
var
  i, j : integer;
begin
  readln(m, n);
  for i := 1 to m do
  begin
    for j := 1 to n do read(a[i, j]);
    readln;
  end;
  found := false;
end;

function ok(x, y : integer) : boolean;
begin
  ok := (1 <= x) and (x <= m) and (1 <= y) and (y <= n) and (a[x, y] <> '*');
end;

procedure DFS(x, y : integer);
var
  i, x1, y1 : integer;
begin
  if (x = m) and (y = n) then
  begin
    found := true;
    exit;
  end;

  for i := 1 to 4 do
  begin
    x1 := x + dx[i];
    y1 := y + dy[i];
    if ok(x1, y1) and (trace[x1, y1] = 0) then
    begin
      trace[x1, y1] := 5-i;
      DFS(x1, y1);
      if found then exit;
    end;
  end;
end;

procedure process;
begin
  fillchar(trace, sizeof(trace), 0);
  trace[1, 1] := -1;
  DFS(1, 1);
end;

procedure tracing(x, y : integer);
var
  x1, y1, h : integer;
begin
  h := trace[x, y];
  if h = -1 then
  begin
    writeln(x, ' ', y);
    exit;
  end;
  x1 := x + dx[h];
  y1 := y + dy[h];
  tracing(x1, y1);
  writeln(x, ' ', y);
end;

procedure out;
begin
  tracing(m, n);
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);

  inp;
  process;
  out;

  close(output);
  close(input);
end.
